#include "main/utils.h"
using namespace std;

class Solution {
public:
    int maxArea(vector<int>& height) {
      int left = 0, right = height.size() - 1;
      int max_area = 0;
      while (left < right) {
        int cur_area = min(height[left], height[right]) * (right - left);
        max_area = max(cur_area, max_area);
        if (height[left] < height[right]) {
          left++;
        } else {
          right--;
        }
      }
      return max_area;
    }
};

int main() {
  vector<int> input = {1, 8, 6, 2, 5, 4, 8, 3, 7};
  Solution su;
  cout << su.maxArea(input) << endl;
}
